from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By

from selenium import webdriver

# ***********关键行**爬完后浏览器不自动关闭************************
options = webdriver.ChromeOptions()
options.add_experimental_option('detach', True)
driver = webdriver.Chrome(options=options)
# *************关键行结束***************************************

#driver.find_element(By.XPATH, '//*[@id="kw"]').send_keys("python")
#driver.find_element(By.XPATH, '//*[@id="su"]').click()
driver.get('https://www.baidu.com/')
driver.find_element(By.XPATH, '//*[@id="kw"]').send_keys("python")
driver.find_element(By.XPATH, '//*[@id="su"]').click()

